import "package:flutter/material.dart";
import "./RecommendItemContent.dart";
import "RecommendItemUPInfo.dart";

// 番剧类型推荐的番剧类
class RecommendItemAnimateItem {
  String playCount; //播放量
  String likeCount; //点赞量
  String coverUrl; //封面地址
  String title; //标题
  RecommendItemAnimateItem({
    required this.playCount,
    required this.likeCount,
    required this.coverUrl,
    required this.title,
  });
}

// 番剧类型推荐的番剧类
class RecommendItemAnimateItemWidget extends StatelessWidget {
  final RecommendItemAnimateItem recommendItemAnimateItem;
  final RecommendItemUPInfo? recommendItemUPInfo;
  const RecommendItemAnimateItemWidget({
    super.key,
    required this.recommendItemAnimateItem,
    this.recommendItemUPInfo,
  });
  @override
  Widget build(BuildContext context) {
    TextStyle textStyle = const TextStyle(
      fontSize: 10,
      color: Colors.white,
    );
    return RecommendItemContentWidget(
      imageUrl: recommendItemAnimateItem.coverUrl,
      title: recommendItemAnimateItem.title,
      imageBottomBar: Padding(
        padding: const EdgeInsets.fromLTRB(5, 4, 5, 2),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Expanded(
              flex: 1,
              child: Row(
                children: [
                  const Icon(
                    Icons.ondemand_video,
                    size: 12,
                    color: Colors.white,
                  ),
                  Padding(
                    padding: const EdgeInsets.only(left: 3),
                    child: Text(
                      recommendItemAnimateItem.playCount,
                      style: textStyle,
                    ),
                  ),
                ],
              ),
            ),
            Expanded(
              flex: 1,
              child: Row(
                children: [
                  const Icon(
                    Icons.heart_broken,
                    size: 12,
                    color: Colors.white,
                  ),
                  Padding(
                    padding: const EdgeInsets.only(left: 3),
                    child: Text(
                      recommendItemAnimateItem.likeCount,
                      style: textStyle,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
      footer: Row(
        children: [
          Expanded(
            flex: 1,
            child: Padding(
              padding: const EdgeInsets.only(left: 4),
              child: Text(
                recommendItemUPInfo?.name ?? '',
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: const TextStyle(
                  color: Colors.black54,
                  fontSize: 12,
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
